<template>
  <div>
    <el-dialog title="活动信息" :visible.sync="dialogFormVisible" :loading="loading" width="800px">
      <el-form :model="act">
        <el-form-item label="活动编号" :label-width="formLabelWidth" prop="actId">
          <el-input v-model="act.actId" autocomplete="off" :readonly="readonly" />
        </el-form-item>
        <el-form-item label="活动标题" :label-width="formLabelWidth" prop="actTitle">
          <el-input v-model="act.actTitle" autocomplete="off" :readonly="readonly" />
        </el-form-item>
        <el-form-item label="活动发起人" :label-width="formLabelWidth" prop="actHost">
          <el-input v-model="act.actHost" autocomplete="off" :readonly="readonly" />
        </el-form-item>

        <el-form-item label="活动最大人数" :label-width="formLabelWidth" prop="actLimit">
          <el-input v-model="act.actLimit" autocomplete="off" :readonly="readonly" />
        </el-form-item>

        <el-form-item label="活动地点" :label-width="formLabelWidth" prop="actAddress">
          <el-input v-model="act.actAddress" autocomplete="off" :readonly="readonly" />
        </el-form-item>

        <el-form-item label="活动位置" :label-width="formLabelWidth" prop="actAddressType">
          <el-input v-if="act.actAddressType=='1'" value="校内" autocomplete="off" :readonly="readonly" />
          <el-input v-if="act.actAddressType=='2'" value="校外" autocomplete="off" :readonly="readonly" />
        </el-form-item>

        <el-form-item label="活动类型" :label-width="formLabelWidth" prop="actType">
          <el-input v-if="act.actType=='0'" value="学习" autocomplete="off" :readonly="readonly" />
          <el-input v-if="act.actType=='1'" value="娱乐" autocomplete="off" :readonly="readonly" />
        </el-form-item>
        <el-form-item label="活动状态" :label-width="formLabelWidth" prop="actStatus">
          <el-input v-if="act.actStatus=='0'" value="审核中" autocomplete="off" :readonly="readonly" />
          <el-input v-if="act.actStatus=='1'" value="审核通过" autocomplete="off" :readonly="readonly" />
          <el-input v-if="act.actStatus=='2'" value="审核不通过" autocomplete="off" :readonly="readonly" />
          <el-input v-if="act.actStatus=='3'" value="报名中" autocomplete="off" :readonly="readonly" />
          <el-input v-if="act.actStatus=='4'" value="报名截止" autocomplete="off" :readonly="readonly" />
          <el-input v-if="act.actStatus=='5'" value="活动结束" autocomplete="off" :readonly="readonly" />

        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">关 闭</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
import {
  getActivityByActId
} from '../../api/act.js'
export default {
  name: 'Info',
  components: 'Info',
  props: {
    actId: String,
    show: {
      default: false,
      require: true
    }
  },
  data() {
    return {
      act: {},
      loading: false,
      dialogFormVisible: false,
      formLabelWidth: '150px',
      title: '查看活动信息',
      readonly: true
    }
  },
  create() {

  },
  watch: {},
  methods: {

    showInfo(actId) {
      console.log(actId)
      this.title = '查看活动信息'
      this.readonly = true
      this.fetchData(actId)
    },
    fetchData(actId) {
      console.log(actId)
      this.loading = true
      getActivityByActId(actId).then((data) => {
        this.act = data.obj
        console.log(data)
        console.log(this.act)
        this.loading = false
        this.dialogFormVisible = true
      })
    }
  }

}
</script>

<style scoped>

</style>
